package com.googlecode.xcarve.benchmark;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.googlecode.xcarve.demoservice.DemoService;

public class BenchmarkClient extends AbstractBenchmarkClient {
	
	private DemoService demo;
	public BenchmarkClient() {
		ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath*:service-refer.xml");
		this.demo = (DemoService)ctx.getBean("demoServiceRefer");
	}
	
    @Override
    public ClientRunnable getClientRunnable(String targetIP, int targetPort, int clientNums, int rpcTimeout,
                                            CyclicBarrier barrier,
                                            CountDownLatch latch,long startTime, long endTime) {
        return new SimpleProcessorBenchmarkClientRunnable(demo,targetIP, targetPort, clientNums, rpcTimeout,
                                                         barrier, latch, startTime, endTime);
    }

    public static void main(String[] args) throws Exception {
        new BenchmarkClient().run(args);
    }
}
